package com.estate.struts.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.estate.utils.ProjectConstants;
import com.estate.vo.impl.UserInfoVo;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class EstateSupport extends ActionSupport {

	public HttpSession getSession(){
		return ServletActionContext.getRequest().getSession();
	}
	
	public HttpServletRequest getRequest(){
		return ServletActionContext.getRequest();
	}
	
	public ActionContext getApplication(){
		return ServletActionContext.getContext();
	}
	
	public void setSessionUser(UserInfoVo user){
		this.getSession().setAttribute(ProjectConstants.USER_SESSION_KEY, user);
	}
	
	public UserInfoVo getSessionUser(){
		return (UserInfoVo) this.getSession().getAttribute(ProjectConstants.USER_SESSION_KEY);
	}
}
